home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / 13h_kit / win.doc < prev    next >
Text File  |  1991-07-04  |  5KB  |  112 lines

  1. >>>WIN.DOC
  2.  
  3. A. Copyright Information
  4.  
  5. Images.Hpp and Images.Cpp along with this document file are copyright
  6. 1991 by the Gamers Programming Workshop, GAMERS forum, Compuserve (GO GAMERS,
  7. section 11). The code and related document are free for use, distribution,
  8. and modification, provided the following conditions are met:
  9.  
  10.     1. no commercial use of this source code or documents is permitted.
  11.     2. no fee may be charged beyond disk duplication cost for any of this
  12.        material.
  13.     3. If the code is upgraded or modified a copy of the modification must
  14.        be uploaded to section 11 of the GAMERS forum on Compuserve. All
  15.        modifications must be documented and the author's name included in
  16.        the source code header block, and the subsequent file package must
  17.        include all the original doc files as well as any additions. If you
  18.        modify or add functions please update the function list below.
  19.  
  20.  
  21. B. Description
  22.  
  23. The win class as declared in IMAGES.HPP provides a simple means of creating
  24. window areas on a mode 13h screen. The class allocates memory for, and saves
  25. it's own background, so multiple windows can be created on top of one and
  26. other, and each will restore the pre-existing background when it is deleted
  27. or goes out of scope. Windows can be created in any size, and with any back-
  28. ground color (including a bitmap), with or without a border of any color and
  29. width, and with or without a shadow of any color and width.
  30.  
  31. The declaration of the class is shown below:
  32.  
  33. class win {
  34.     public:
  35.     char status;                        // 1 if window opened successfully
  36.     win(int tlx, int tly, int xwid, int ywid, char *bmap,
  37.         char brdrwid, char shdwwid, char bgrnd, char border);
  38.     char installed(){return(status);}   // returns the status value
  39.     ~win();
  40.  
  41.     private:
  42.     char far *backgrnd;      // pointer to background bitmap
  43.     int origX;               // top left x coord of the window
  44.     int origY;               // top left y coord of the window
  45.     int xsize;               // window x dimension in pixels
  46.     int ysize;               // window y dimension in pixels
  47.     char bdrwid;             // border width, 0 if no border
  48.     char shdwid;             // shadow width, 0 if no shadow
  49.     char shdwon;             // 1 if shadow is on, 0 if not
  50.     char b_grnd;             // window background color
  51.     char brdr;               // border color, ignored if bdrwid=0;
  52. };
  53.  
  54. C. Function interface
  55.  
  56. *****************************************************************************
  57.  
  58.  win(int tlx, int tly, int xwid, int ywid, char *bmap,
  59.      char brdrwid, char shdwwid, char bgrnd, char border);
  60.  
  61.  The constructor creates and displays the window. The following values are
  62.  passed:
  63.             tlx     - top left x coord for window location
  64.             tly     - top left y coord for window location
  65.             xwid    - width of window in pixels in x dimension
  66.             ywid    - depth of window in lines (pixels) in y dimension
  67.             *bmap   - pointer to window bitmap (NULL if none)
  68.             brdrwid - width of colored border around window, 0 if none
  69.             shdwwid - width of window drop shadow, 0 if none
  70.             bgrnd   - window background color (N/A if bmap != NULL)
  71.             border  - border color (N/A if brdrwid == 0)
  72.  
  73.  If bmap != NULL the window background when displayed will consist of the
  74.  rectangular bitmap pointed to by bmap. The bitmap is assumed to be the same
  75.  size as the window area, and the byte pointed to by bmap is assumed to be
  76.  the leftmost pizel of the first line of the image. If bmap == NULL then the
  77.  window will be created using a background of bgrnd color. Shadow drops down
  78.  and to the right. This is not selectable in the current methods, but methods
  79.  to change it could be added easily.
  80.  
  81.  A window is created by declaring an instance, as follows:
  82.  
  83.     win info(10,10,150,75,NULL,0,4,9,0);
  84.  
  85.  or
  86.     win *info
  87.     info = new win(10,10,150,75,NULL,0,4,9,0);
  88.  
  89.  Both of these methods creat a window at 10,10, 150 pixles wide by 75 lines
  90.  deep, with no border, a 4 pixel wide shadow, and a light blue background.
  91.  Immediately after declaring the instance you should check win.status for
  92.  any error during construction. It will contain one of the error constants
  93.  defined in IMAGES.HPP.
  94.  
  95. *****************************************************************************
  96.  
  97.  ~win()
  98.  
  99.  The destructor closes the window, frees memory, and restores the background.
  100.  
  101.  In the examples above the window would either close when the info instance
  102.  went out of scope, or when it was explicitly deleted.
  103.  
  104. *****************************************************************************
  105.  
  106. D. Support
  107.  
  108. Support for this tool will be provided as and where possible through mess-
  109. ages posted to 76605,2346 in the Game Design section (sec. 11) of the Gamers
  110. Forum on Compuserve. Sorry, no telephone support is possible.
  111.  
  112.